Skip to content

refactor: Reference top-level settings instead of FEATURES#38095

Draft
kdmccormick wants to merge 13 commits intoopenedx:masterfrom
kdmccormick:kdmccormick/features2
Draft

refactor: Reference top-level settings instead of FEATURES#38095
kdmccormick wants to merge 13 commits intoopenedx:masterfrom
kdmccormick:kdmccormick/features2

Conversation

@kdmccormick
Copy link
Member

Description

WIP

Replace each reference to the FEATURES dictionary with the equivalent top-level Django settings reference.

Supporting information

TBC

Testing instructions

TBC

Deadline

Verawood code freeze

Other information

AI notes

I used claude code -- more TBC

It was referenced before both as a regular Django setting
(via the deprecated FEATURES dict) and as a SettingToggle. Picking one
makes the FEATURES refactoring easier. We picked regular Django setting,
because there is non-cms code which needs to query this setting, so
a SettingToggle defined in cms/djangoapps/contentstore is not viable.
The pattern `settings.FEATURES.get('FOO')` is deprecated in favor
of `settings.FOO`. The latter pattern is stricter: it will raise an
AttributeError if the settings is missing rather than silently returning
None (e.g., False).

In order to move to the stricter pattern, we must move several settings'
from variant-specific config at (lms,cms)/envs/common.py up into
shared config at openedx/envs/common.py. That way, when the setting
is referenced in the other service variant, it does not AttributeError.

These settings all have falsy defaults, so we are not changing any
application logic by defining them with these defaults.
With this change, every call to `settings.FEATURES.get('FOO')` now
has a matching common setting definition, we we can call
`settings.FOO` without raising an AttributeError on non-overridden
settings.
@kdmccormick kdmccormick force-pushed the kdmccormick/features2 branch from 8d05b2a to 8e243dc Compare March 4, 2026 22:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant